<?php 
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header');
?> 
<script language="javascript" type="text/javascript" src="<?php echo JS_PATH;?>commoncheck.js"></script>
<body onload="rolecheck()">
<div class="txt_head_frame">
	<span class="txt_frame_title">修改角色</span>
</div>
<div id="main_content">
<form name="myform" action="?m=admin&c=role&a=edit" method="post" id="myform">
<input type="hidden" name="roleid" value="<?php echo $roleid?>"></input>
<div class="txt_content_frame">
	<div class="txt_content_box">
		<div class="txt_content_left">
			<div class="txt_text_left">角色名称:<span>[*]</span></div>
			<div class="txt_left_input"><input name="info[rolename]" type="text" class="txt" id="rolename" value="<?php echo $rolename;?>"/></div><span id="validaterolename" class="validate"></span><br/><br/>
            <div class="txt_text_left">角色描述:</div>
			<div class="txt_left_input">
			<textarea class="txt_txtarea_font" rows="4" cols="50" name="info[description]" id="description"><?php echo $description;?></textarea>
			</div><span id="validatedescription" class="validate"></span><br/><br/>
		</div>
	</div>
</div>

<div class="txt_btn">
	<input name="dosubmit" type="submit" class="txt_btn_a" value=" 保存 " />
</div>
</form>
</div>
</body>
<script type="text/javascript">
<!--
//角色检测
function rolecheck(){
	$('#rolename').blur(function(){
		var validateName = $('#validaterolename');
		if(!isNotNull($(this).val())){
			validateName.html('<img src="images/false.gif" width=16 heigth=16>角色名称不能为空');
		} else{
			var t = this;
			if(this.value != this.lastValue){
				if(this.timer){clearTimeout(this.timer);}
				validateName.html('<img src="images/onLoad.gif" width=16 heigth=16>检测中');	
				this.timer = setTimeout(function(){
					$.ajax({
						url:"",
						data:"m=admin&c=role&a=public_checkname_ajx&rolename="+t.value,
						type:'get',
						success : function(data){
							if(data == "0"){									
								validateName.html('<img src="images/false.gif" width=16 heigth=16>角色已存在');		
							}else {	
								validateName.html('<img src="images/true.gif" width=16 heigth=16>');		
							}
						}
					});				
				},200);
			  this.lastValue = this.value;
			} 
		}
	});
}
//-->
</script>
</html>